package com.yuw.service.impl;

import com.yuw.bean.AdminInfoBean;
import com.yuw.dao.AdminInfoBeanMapper;
import com.yuw.service.IAdminInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 使用@Service注解标注，该类是SpringMVC框架的service层
 */
@Service
public class AdminInfoServiceImpl implements IAdminInfoService {

    /*
     使用注解获取Mybatis框架的Mapper接口的实现类的实例对象
     此处使用了spring框架的IOC和DI
     也使用了面向接口的编程软件原则
     */
    @Autowired
    AdminInfoBeanMapper adminInfoMapper;

    @Override
    public List<AdminInfoBean> queryLoginInfo(AdminInfoBean adminInfoBean) {
        // 调用mapper层的接口方法进行数据库操作
        List<AdminInfoBean> lstAdminInfos = adminInfoMapper.queryLoginInfo(adminInfoBean);
        // 返回结果
        return lstAdminInfos;
    }

    @Override
    public List<AdminInfoBean> selectAdminInfoByParams(AdminInfoBean record) {
        return adminInfoMapper.selectAdminInfoByParams(record);
    }

    @Override
    public AdminInfoBean selectByPrimaryKey(Integer adminid) {
        return adminInfoMapper.selectByPrimaryKey(adminid);
    }

    @Override
    public int insertSelective(AdminInfoBean record) {
        return adminInfoMapper.insertSelective(record);
    }

    @Override
    public int updateByPrimaryKeySelective(AdminInfoBean record) {
        return adminInfoMapper.updateByPrimaryKeySelective(record);
    }
}
